<template>
	<view class="addres-box" :style="{direction:i18nLocale=='ug'?'rtl':''}" @click="changeaddress">
		<image :src="getImgSrc(userInfo.logo)" mode=""></image>
		<text v-if="userInfo" >{{i18nLocale=='ug'?userInfo.ug_name:userInfo.cn_name}}</text>
	</view>
</template>

<script>
	import {
		Translation
	} from '@/utils/getAddres.js';
	export default {
		name: "Address",
		data() {
			return {

			};
		},
		computed: {
			
			i18nLocale() {
				return this.$i18n.locale;
			},
			userInfo(){
				return this.$store.state.shopinfo;
			}
		},
		// async mounted() {
		//   if (this.$store.state.address ) {
		//     try {
		//       const address = await Translation(this.$store.state.address.pois[0].title);
		//       console.log('Address:', address);
		//     } catch (error) {
		//       console.error('Error:', error);
		//     }
		//   } else {
		//     console.error('Address data is not available');
		//   }
		// }
		methods:{
			changeaddress(){
				uni.navigateTo({
					url:'/pages/me/address/selecetaddress'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.addres-box {
		width: 100%;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		background-color: $uni-bg-color-box;
		border-radius: $uni-border-radius-base;
		box-shadow: $uni-bg-shadow;
		margin-top: $uni-spacing-margin-sm;
		padding: $uni-spacing-padding-sm;
		image{
			width:100rpx;
			height:100rpx;
			border-radius: 20rpx;;
		}
		text {
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
			color: $uni-color-title;
			padding: 0rpx 10rpx;
			font-size: $uni-font-size-base;
			
		}
	}
</style>